<?php
//including header.php 
include '../../include/header.php';
//including page.php (It is a class which contain functions)
include '../../libraries/page.php';
//created object for page.php
$page = new page();
session_start();
$userid = $_SESSION['userid'];

//To get current date and time
date_default_timezone_set('Asia/Calcutta');
$date1 = date("d-m-Y H:i:s");

// checking the session
if (!$_SESSION['username']) {
    header("location:../user/login.php");
}
if ($_GET['q'] == 'logout') {
    $page->user_logout();
    header("location:../user/login.php");
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {

    $result = $page->mysql_insert_array("heads", $_POST, "submit");
    if ($result) {
        $msg = $message[1];
    } else {
        $msg = $message[0];
    }
}
?>

<!--------------------------------------------------content----------------------------------->

<!-------------------------------------Navbar---------------------------------->
<?
$account_heads = 'active';
include '../../include/navbar.php';
?>

<div class="bread_crumb" style="margin-left: 2%">
    &laquo;  <a href="account_heads">Back</a>
  </div>
<!----------------------------------Display the result message of Addition--------------------->
<div  align="center"><? echo $msg; ?></div>


    <!---------------------------------form------------------------------------------------>
    <form method="POST"  action="">
        <div class="maindiv">
    <h3 style="color:#777;text-align: center">Add Head</h3>
            <div class="leftdiv">
                    <label>Head Type</label>
                    <input class="input-xlarge" id="focusedInput" type="text" name ="headtype" placeholder="Enter head type.."  required>
            </div>
            <div class="middiv"></div>
            <div class="rightdiv">
                    <label>Root ID</label>
                    <input class="input-xlarge" id="focusedInput" type="number" name ="rootid" placeholder="Enter Root ID.."  required>
            </div>
            <div class="leftdiv">
                    <label>Name</label>
                    <input class="input-xlarge" id="focusedInput" type="text" name ="name" placeholder="Enter batchno..." >
            </div>
            <div class="middiv"></div>
            <div class="rightdiv">
                    <label>Type</label>
                    <input class="input-xlarge" id="focusedInput" type="text"  name ="type"  placeholder="Enter type...">
            </div>
            <div class="leftdiv">
                    <label>Balance</label>
                    <input class="input-xlarge" id="focusedInput" type="text" name ="balance" placeholder="Enter balance ..."   >
            </div>
            <div class="middiv"></div>
            <div class="rightdiv">
                    <label>Address</label>
                    <input class="input-xlarge" id="focusedInput" type="text" name ="address" placeholder="Enter address... "   >
            </div>
            <div class="leftdiv">
                    <label>Contact Name</label>
                    <input class="input-xlarge" id="focusedInput" type="text" name ="contactname" placeholder="Enter contact name..."  >
            </div>
                <div class="middiv"></div>
                <div class="rightdiv">
                    <label>Phone</label>
                    <input class="input-xlarge" id="focusedInput" type="text" name ="phone" placeholder="Enter phone no..."  >
                 
                </div>
                  <div class="leftdiv">
                    <label>Tin</label>
                    <input class="input-xlarge" id="focusedInput" type="text" name ="tin" placeholder="Enter Tin..."  >
            </div>
                <div class="middiv"></div>
                <div class="rightdiv">
                   
                </div>
                 
                <div class="fulldiv" style="clear: both">
                    <div class="btn1"><button class="btn btn-inverse"  type="submit" name="submit" >Add</button></div>
                </div>
        </div>

    </form>
</div>

<?php
//including footer.php
include '../../include/footer.php';
?>
